/*
 * Copyright (c) 2009, Balazs Lecz <leczbalazs@gmail.com>
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 * 
 *     * Redistributions of source code must retain the above copyright notice,
 *       this list of conditions and the following disclaimer.
 * 
 *     * Redistributions in binary form must reproduce the above copyright notice,
 *       this list of conditions and the following disclaimer in the documentation
 *       and/or other materials provided with the distribution.
 * 
 *     * Neither the name of Balazs Lecz nor the names of
 *       contributors may be used to endorse or promote products derived from this
 *       software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 */

package com.lecz.android.checklists;

import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase.CursorFactory;

public class ChecklistDBAdapter {
	private static final String DATABASE_NAME = "checklists.db";
	private static final int DATABASE_VERSION = 2;

	// Tables
	private static final String TABLE_CHECKLIST_GROUPS = "checklist_groups";
	private static final String TABLE_CHECKLISTS = "checklists";
	private static final String TABLE_CHECKLIST_SECTIONS = "checklist_sections";
	private static final String TABLE_CHECKLIST_ITEMS = "checklist_items";
	
	public static final String KEY_ID = "_id";
	public static final int COLUMN_ID = 0;
	
	// "checklist_groups" table columns
	public static final String KEY_CHECKLIST_GROUPS_NAME = "name";
	public static final int COLUMN_CHECKLIST_GROUPS_NAME = 1;
	
	// "checklists" table columns
	public static final String KEY_CHECKLISTS_GROUP_ID = "group_id";
	public static final int COLUMN_CHECKLISTS_GROUP_ID = 1;
	public static final String KEY_CHECKLISTS_NAME = "name";
	public static final int COLUMN_CHECKLISTS_NAME = 2;

	// "checklist_sections" table columns
	public static final String KEY_CHECKLIST_SECTIONS_CHECKLIST_ID = "checklist_id";
	public static final int COLUMN_CHECKLIST_SECTIONS_CHECKLIST_ID = 1;
	public static final String KEY_CHECKLIST_SECTIONS_NAME = "name";
	public static final int COLUMN_CHECKLIST_SECTIONS_NAME = 2;

	// "checklist_items" table columns
	public static final String KEY_CHECKLIST_ITEMS_SECTION_ID = "section_id";
	public static final int COLUMN_CHECKLIST_ITEMS_SECTION_ID = 1;
	public static final String KEY_CHECKLIST_ITEMS_CHALLENGE = "challenge";
	public static final int COLUMN_CHECKLIST_ITEMS_CHALLENGE = 2;
	public static final String KEY_CHECKLIST_ITEMS_RESPONSE = "response";
	public static final int COLUMN_CHECKLIST_ITEMS_RESPONSE = 3;

	
	public static final String[] COLUMNS_CHECKLIST_GROUPS = {
		KEY_ID,
		KEY_CHECKLIST_GROUPS_NAME,
	};

	public static final String[] COLUMNS_CHECKLISTS = {
		KEY_ID,
		KEY_CHECKLISTS_GROUP_ID,
		KEY_CHECKLISTS_NAME,
	};

	public static final String[] COLUMNS_CHECKLIST_SECTIONS = {
		KEY_ID,
		KEY_CHECKLIST_SECTIONS_CHECKLIST_ID,
		KEY_CHECKLIST_SECTIONS_NAME,
	};

	public static final String[] COLUMNS_CHECKLIST_ITEMS = {
		KEY_ID,
		KEY_CHECKLIST_ITEMS_SECTION_ID,
		KEY_CHECKLIST_ITEMS_CHALLENGE,
		KEY_CHECKLIST_ITEMS_RESPONSE,
	};

	private SQLiteDatabase mDB;
	private ChecklistDBOpenHelper mDBHelper;
	
	public ChecklistDBAdapter(Context context) {
		mDBHelper = new ChecklistDBOpenHelper(context, DATABASE_NAME, null, DATABASE_VERSION);
	}
	
	public ChecklistDBAdapter open() throws SQLException {
		mDB = mDBHelper.getWritableDatabase();
		return this;
	}
	
	public void close() {
		mDB.close();
	}
	
	// Queries
	public Cursor getChecklistGroups() {
		return mDB.query(
				/*table*/ TABLE_CHECKLIST_GROUPS,
				/*columns*/ new String[] {KEY_ID, KEY_CHECKLIST_GROUPS_NAME},
				/*selection*/ null,
				/*selectionArgs*/ null,
				/*groupBy*/ null,
				/*having*/ null,
				/*orderBy*/ KEY_CHECKLIST_GROUPS_NAME);
	}
	
	public Cursor getChecklistGroup(long checklistGroupId) {
		return mDB.query(
				/*table*/ TABLE_CHECKLIST_GROUPS,
				/*columns*/ new String[] {KEY_ID, KEY_CHECKLIST_GROUPS_NAME},
				/*selection*/ KEY_ID + " = ?",
				/*selectionArgs*/ new String[] {"" + checklistGroupId},
				/*groupBy*/ null,
				/*having*/ null,
				/*orderBy*/ null);
	}
	
	public Cursor getChecklists(long checklistGroupId) {
		return mDB.query(
				/*table*/ TABLE_CHECKLISTS,
				/*columns*/ new String[] {KEY_ID, KEY_CHECKLISTS_GROUP_ID, KEY_CHECKLISTS_NAME},
				/*selection*/ KEY_CHECKLISTS_GROUP_ID + " = ?",
				/*selectionArgs*/ new String[] {"" + checklistGroupId},
				/*groupBy*/ null,
				/*having*/ null,
				/*orderBy*/ KEY_ID);
	}

	public Cursor getChecklist(long checklistId) {
		return mDB.query(
				/*table*/ TABLE_CHECKLISTS,
				/*columns*/ new String[] {KEY_ID, KEY_CHECKLISTS_GROUP_ID, KEY_CHECKLISTS_NAME},
				/*selection*/ KEY_ID + " = ?",
				/*selectionArgs*/ new String[] {"" + checklistId},
				/*groupBy*/ null,
				/*having*/ null,
				/*orderBy*/ null);
	}

	public Cursor getChecklistSections(long checklistId) {
		return mDB.query(
				/*table*/ TABLE_CHECKLIST_SECTIONS,
				/*columns*/ new String[] {KEY_ID, KEY_CHECKLIST_SECTIONS_CHECKLIST_ID, KEY_CHECKLIST_SECTIONS_NAME},
				/*selection*/ KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + " = ?",
				/*selectionArgs*/ new String[] {"" + checklistId},
				/*groupBy*/ null,
				/*having*/ null,
				/*orderBy*/ KEY_ID); // FIXME(leczbalazs): implement user-defined ordering
	}

	public Cursor getChecklistItems(long sectionId) {
		return mDB.query(
				/*table*/ TABLE_CHECKLIST_ITEMS,
				/*columns*/ new String[] {KEY_ID, KEY_CHECKLIST_ITEMS_SECTION_ID, KEY_CHECKLIST_ITEMS_CHALLENGE, KEY_CHECKLIST_ITEMS_RESPONSE},
				/*selection*/ KEY_CHECKLIST_ITEMS_SECTION_ID + " = ?",
				/*selectionArgs*/ new String[] {"" + sectionId},
				/*groupBy*/ null,
				/*having*/ null,
				/*orderBy*/ KEY_ID); // FIXME(leczbalazs): implement user-defined ordering
	}
	
	private static class ChecklistDBOpenHelper extends SQLiteOpenHelper {
		private static final String SQL_DATABASE_CREATE_CHECKLIST_GROUPS =
			"create table " + TABLE_CHECKLIST_GROUPS + " ("
			+ KEY_ID + " integer primary key autoincrement, "
			+ KEY_CHECKLIST_GROUPS_NAME + " text not null"
			+ ");"
			;

		private static final String SQL_DATABASE_CREATE_CHECKLISTS =
			"create table " + TABLE_CHECKLISTS + " ("
			+ KEY_ID + " integer primary key autoincrement, "
			+ KEY_CHECKLISTS_GROUP_ID + " integer "
				+ "constraint checklist_group_fk references "
				+ TABLE_CHECKLIST_GROUPS + "(" + KEY_ID + "), "
			+ KEY_CHECKLISTS_NAME + " text not null"			
			+ ");"
			;

		private static final String SQL_DATABASE_CREATE_CHECKLIST_SECTIONS =
			"create table " + TABLE_CHECKLIST_SECTIONS + " ("
			+ KEY_ID + " integer primary key autoincrement, "
			+ KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + " integer "
				+ "constraint checklist_fk references "
				+ TABLE_CHECKLISTS + "(" + KEY_ID + "), "
			+ KEY_CHECKLIST_SECTIONS_NAME + " text not null"			
			+ ");"
			;

		private static final String SQL_DATABASE_CREATE_CHECKLIST_ITEMS =		
			"create table " + TABLE_CHECKLIST_ITEMS + " ("
			+ KEY_ID + " integer primary key autoincrement, "
			+ KEY_CHECKLIST_ITEMS_SECTION_ID + " integer "
				+ "constraint section_fk references "
				+ TABLE_CHECKLIST_SECTIONS + "(" + KEY_ID + "), "
			+ KEY_CHECKLIST_ITEMS_CHALLENGE + " text not null, "
			+ KEY_CHECKLIST_ITEMS_RESPONSE + " text"
			+ ");"			
			;

		private static final String SQL_DATABASE_DROP_CHECKLIST_ITEMS =
			"drop table if exists " + TABLE_CHECKLIST_ITEMS + ";";
		private static final String SQL_DATABASE_DROP_CHECKLISTS =
			"drop table if exists " + TABLE_CHECKLISTS + ";";
		private static final String SQL_DATABASE_DROP_CHECKLIST_SECTIONS =
			"drop table if exists " + TABLE_CHECKLIST_SECTIONS + ";";
		private static final String SQL_DATABASE_DROP_CHECKLIST_GROUPS =
			"drop table if exists " + TABLE_CHECKLIST_GROUPS + ";";
		
		public ChecklistDBOpenHelper(Context context, String name, CursorFactory factory, int version) {
			super(context, name, factory, version);
		}

		@Override
		public void onCreate(SQLiteDatabase db) {
			db.execSQL(SQL_DATABASE_CREATE_CHECKLIST_GROUPS);
			db.execSQL(SQL_DATABASE_CREATE_CHECKLISTS);
			db.execSQL(SQL_DATABASE_CREATE_CHECKLIST_SECTIONS);
			db.execSQL(SQL_DATABASE_CREATE_CHECKLIST_ITEMS);
			
			// Add test data
			// FIXME(leczbalazs): remove this section before releasing to the Android Market
			db.execSQL("insert into " + TABLE_CHECKLIST_GROUPS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_GROUPS_NAME + ") values (1, 'C172');");
			
			db.execSQL("insert into " + TABLE_CHECKLISTS
					+ " (" + KEY_ID + ", " + KEY_CHECKLISTS_GROUP_ID + ", " + KEY_CHECKLISTS_NAME + ") "
					+ " values (1, 1, 'PRE-FLIGHT INSPECTION');");
			db.execSQL("insert into " + TABLE_CHECKLISTS
					+ " (" + KEY_ID + ", " + KEY_CHECKLISTS_GROUP_ID + ", " + KEY_CHECKLISTS_NAME + ") "
					+ " values (2, 1, 'BEFORE TAKEOFF');");
			db.execSQL("insert into " + TABLE_CHECKLISTS
					+ " (" + KEY_ID + ", " + KEY_CHECKLISTS_GROUP_ID + ", " + KEY_CHECKLISTS_NAME + ") "
					+ " values (3, 1, 'LINE UP');");
			db.execSQL("insert into " + TABLE_CHECKLISTS
					+ " (" + KEY_ID + ", " + KEY_CHECKLISTS_GROUP_ID + ", " + KEY_CHECKLISTS_NAME + ") "
					+ " values (4, 1, 'TAKEOFF');");
			db.execSQL("insert into " + TABLE_CHECKLISTS
					+ " (" + KEY_ID + ", " + KEY_CHECKLISTS_GROUP_ID + ", " + KEY_CHECKLISTS_NAME + ") "
					+ " values (5, 1, 'LANDING');");
			db.execSQL("insert into " + TABLE_CHECKLISTS
					+ " (" + KEY_ID + ", " + KEY_CHECKLISTS_GROUP_ID + ", " + KEY_CHECKLISTS_NAME + ") "
					+ " values (6, 1, 'PARKING');");
			db.execSQL("insert into " + TABLE_CHECKLISTS
					+ " (" + KEY_ID + ", " + KEY_CHECKLISTS_GROUP_ID + ", " + KEY_CHECKLISTS_NAME + ") "
					+ " values (7, 1, 'ENGINE START');");
			db.execSQL("insert into " + TABLE_CHECKLISTS
					+ " (" + KEY_ID + ", " + KEY_CHECKLISTS_GROUP_ID + ", " + KEY_CHECKLISTS_NAME + ") "
					+ " values (8, 1, 'TAXI');");
			

			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (1, 1, 'CABIN');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (2, 1, 'FUSELAGE & EMPENNAGE');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (3, 1, 'RIGHT WING');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (4, 1, 'NOSE SECTION');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (5, 1, 'LEFT WING');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (6, 2, 'PRE-RUNUP');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (7, 2, 'ENGINE RUNUP');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (8, 2, 'POST-RUNUP');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (9, 3, 'PRIOR TO CLEARANCE ONTO RUNWAY');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (10, 3, 'AFTER CLEARANCE ONTO RUNWAY');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (11, 4, 'NORMAL TAKEOFF');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (12, 4, 'CLIMBOUT');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (13, 4, 'CRUISE');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (14, 5, 'DESCENT TO PATTERN ALTITUDE');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (15, 5, 'ON DOWNWIND LEG');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (16, 5, 'ABEAM THE NUMBERS');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (17, 5, 'ON BASE LEG');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (18, 5, 'ON FINAL');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (19, 5, 'GO AROUND');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (20, 5, 'AFTER LANDING');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (21, 6, 'PARKING');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (22, 7, 'BEFORE STARTING');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (23, 7, 'STARTING');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (24, 8, 'BEFORE TAXI');");
			db.execSQL("insert into " + TABLE_CHECKLIST_SECTIONS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_SECTIONS_CHECKLIST_ID + ", " + KEY_CHECKLIST_SECTIONS_NAME + ") "
					+ " values (25, 8, 'TAXI');");

			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (1, 1, 'Hobbs & tach time', 'RECORD');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (2, 1, 'Required papers A.R.O.W.', 'ON BOARD');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (3, 1, 'Control wheel lock', 'REMOVE & STOW');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (4, 1, 'Ignition key', 'ON DASH');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (5, 1, 'Avionics switch', 'OFF');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (6, 1, 'Master switch', 'ON');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (7, 1, 'Fuel quantity', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (8, 1, 'Lights - Beacon', 'ON');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (9, 1, 'Flaps', 'DOWN');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (10, 1, 'Master switch', 'OFF');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (11, 1, 'Alternate static source', 'OFF');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (12, 1, 'Fuel selector valve', 'BOTH');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (13, 1, 'Fuel tester', 'RETRIEVE & CLEAN');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (14, 2, 'Baggage door', 'SECURE & LOCK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (15, 2, 'General surface condition', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (16, 2, 'Elevator & rudder', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (17, 2, 'Elevator trim', 'NOTE POSITION');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (18, 2, 'Tie down', 'REMOVE');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (19, 3, 'Main gear, tire, brake', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (20, 3, 'Flaps & hinges', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (21, 3, 'Aileron & hinges', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (22, 3, 'Wing tip & navigation light', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (23, 3, 'Leading edge condition', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (24, 3, 'Air inlets', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (25, 3, 'Wing tie down', 'REMOVE');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (26, 3, 'Fuel tank sump', 'DRAIN');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (27, 3, 'Fuel selector drain', 'DRAIN');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (28, 3, 'Fuel quantity & filler cap', 'CHECK & SECURE');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (29, 4, 'Windscreen', 'CHECK CLEAN');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (30, 4, 'Engine cowling condition', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (31, 4, 'Oil level', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (32, 4, 'Oil dipstick', 'CLOSE & SECURE');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (33, 4, 'Fuel strainer drain', 'DRAIN');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (34, 4, 'Propeller & spinner', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (35, 4, 'Engine cooling inlets', 'CHECK CLEAR');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (36, 4, 'Alternator belt', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (37, 4, 'Air filter', 'CHECK CLEAR');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (38, 4, 'Nose gear, tire, strut', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (39, 4, 'Static source opening', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "			
					+ " values (40, 5, 'Main gear, tire, brake', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "			
					+ " values (41, 5, 'Fuel tank sump', 'DRAIN');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "			
					+ " values (42, 5, 'Fuel quantity & filler cap', 'CHECK & SECURE');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "			
					+ " values (43, 5, 'Air inlets', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "			
					+ " values (44, 5, 'Pitot tube cover', 'REMOVE');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "			
					+ " values (45, 5, 'Pitot tube', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "			
					+ " values (46, 5, 'Fuel vent', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "			
					+ " values (47, 5, 'Stall warning opening', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "			
					+ " values (48, 5, 'Wing tie down', 'REMOVE');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "			
					+ " values (49, 5, 'Leading edge condition', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "			
					+ " values (50, 5, 'Wing tip & navigation light', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "			
					+ " values (51, 5, 'Aileron & hinges', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "			
					+ " values (52, 5, 'Flaps & hinges', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "			
					+ " values (53, 5, 'Fuel tester', 'CLEAN & STOW');");

			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (54, 6, 'Aircraft position', 'INTO WIND');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (55, 6, 'Brakes', 'APPLY & HOLD');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (56, 6, 'Doors', 'CLOSED & LATCHED');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (57, 6, 'Flight controls', 'FREE & CORRECT');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (58, 6, 'Fuel selector valve', 'BOTH');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (59, 6, 'Elevator trim', 'TAKEOFF');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (60, 7, 'Mixture', 'RICH');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (61, 7, 'Throttle', '1700 RPM');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (62, 7, 'Suction gauge', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (63, 7, 'Engine instruments & ammeter', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (64, 7, 'Magnetos\n(125 RPM max drop, 50 RPM max diff)', 'CHECK');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (65, 7, 'Carb heat\n(check for drop in RPM)', 'ON');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (66, 7, 'Throttle\n(check for idle)', 'FULL OUT');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (67, 7, 'Carb heat', 'OFF');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (68, 7, 'Throttle', '800-1000 RPM');");
			db.execSQL("insert into " + TABLE_CHECKLIST_ITEMS
					+ " (" + KEY_ID + ", " + KEY_CHECKLIST_ITEMS_SECTION_ID + ", "
					+ KEY_CHECKLIST_ITEMS_CHALLENGE + ", " + KEY_CHECKLIST_ITEMS_RESPONSE + ") "
					+ " values (69, 7, 'Mixture', 'AS REQUIRED');");
		}

		@Override
		public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
			// FIXME(leczbalazs) implement data migration instead of the DROP+CREATE
			db.execSQL(SQL_DATABASE_DROP_CHECKLIST_ITEMS);
			db.execSQL(SQL_DATABASE_DROP_CHECKLISTS);
			db.execSQL(SQL_DATABASE_DROP_CHECKLIST_SECTIONS);
			db.execSQL(SQL_DATABASE_DROP_CHECKLIST_GROUPS);

			onCreate(db);
		}
		
	}
}
